package offer;

public class Solution65 {
    public int add(int a, int b) {
        int c = 0, res = 0;
        for (int i = 0; i < 32; i++) {
            int ai = (a >>> i) & 1, bi = (b >>> i) & 1;
            res = res | ((ai ^ bi ^ c) << i);
            c = (ai & bi) | (ai & c) | (bi & c);
        }
        return res;
    }
}
